package com.service.socket.process;

import org.jboss.netty.channel.Channel;

import com.service.other.Logger;
import com.service.socket.protocol.CmdWord;
import com.service.socket.protocol.Conversion;
import com.service.socket.protocol.Packet;
import com.service.webservice.in.RoadMixingServer;

public class R_Class_E2 extends R_Class_Abstract {
	public R_Class_E2(Channel channel, Packet packet) {
		super(channel, packet);
	}

	@Override
	public void execute() {
		try {
			doQuery();
		} catch (Exception e) {
			Logger.err(e);
		}		
	}
	
	public void doQuery() {
		if (!packet.isCrcValid()) {
			// CRC校验失败
			Logger.err("RoadMixing [" + packet.getDeviceNo() + "] process fail on [CrcValid]:" + packet.isCrcValid()
					+ " [packet]:" + packet.toString());
			return;
		}
		Packet bean = (Packet) packet.clone();
		RoadMixingServer rms = new RoadMixingServer();
		String dataArea = new String(Conversion.hexStringToBytes(bean.dataArea));
		rms.roadMixingSignalJson(dataArea);
	}
	
}
